package cn.hjh.service;

import cn.hjh.dao.ProjectDao;
import cn.hjh.pojo.Project;
import org.hibernate.HibernateException;
import org.hibernate.Transaction;

public class ProjectBiz {
    private ProjectDao projectDao = new ProjectDao();
    public void addNewProject(Project proj){
        Transaction  tx =null;
        try {
            tx= projectDao.currentSession().beginTransaction();
            projectDao.save(proj);
            tx.commit();
        } catch (HibernateException e) {
            e.printStackTrace();
            if (tx != null)
                tx.rollback();
        }
    }
}
